package action;

import java.util.ArrayList;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import bean.DongVatChanNuoiModel;
import bean.DongVatHeSinhThai;
import bean.DongVatLamSanNgoaiGoModel;
import bean.DongVatSanHoModel;
import bean.DongVatTenLaTinModel;
import bean.DongVatThamCoBienModel;
import bean.ThucVatHeSinhThai;
import bean.ThucVatLamSanModel;
import bean.ThucVatLamSanNgoaiGoModel;
import bean.ThucVatSanHoModel;
import bean.ThucVatThamCoBienModel;
import bean.ThucVatTrongTrotModel;
import bo.DongVatProcessBO;
import bo.ThucVatProcessBO;

import form.HomeForm;

public class HomeAction extends Action{

	@Override
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response)
			throws Exception {
		HomeForm homeForm = (HomeForm) form;
		
		ThucVatProcessBO thucVatProcessBO = new ThucVatProcessBO();
		DongVatProcessBO dongVatProcessBO = new DongVatProcessBO();
		
		//---------------------------------THUC VAT------------------------------------------
		// set list he sinh thai thuc vat vao formbean
		ArrayList<ThucVatHeSinhThai> listThucVatHeSinhThai = thucVatProcessBO.listInfoThucVatHeSinhThai();
		ArrayList<ThucVatLamSanModel> listThucVatLamSanModel = thucVatProcessBO.listInfoThucVatLamSanModel();
		ArrayList<ThucVatLamSanNgoaiGoModel> listThucVatLamSanNgoaiGoModel = thucVatProcessBO.listInfoThucVatLamSanNgoaiGoModel();
		ArrayList<ThucVatSanHoModel> listThucVatSanHoModel = thucVatProcessBO.listInfoThucVatSanHoModel();
		ArrayList<ThucVatThamCoBienModel> listThucVatThamCoBienModel = thucVatProcessBO.listInfoThucVatThamCoBienModel();
		ArrayList<ThucVatTrongTrotModel> listThucVatTrongTrotModel = thucVatProcessBO.listInfoThucVatTrongTrotModel();
		
		homeForm.setListThucVatHeSinhThai(listThucVatHeSinhThai);
		homeForm.setListThucVatLamSanModel(listThucVatLamSanModel);
		homeForm.setListThucVatLamSanNgoaiGoModel(listThucVatLamSanNgoaiGoModel);
		homeForm.setListThucVatSanHoModel(listThucVatSanHoModel);
		homeForm.setListThucVatThamCoBienModel(listThucVatThamCoBienModel);
		homeForm.setListThucVatTrongTrotModel(listThucVatTrongTrotModel);
		
		//---------------------------------DONG VAT------------------------------------------
		//set list he sinh thai dong vat vao formbean
		ArrayList<DongVatHeSinhThai> listDongVatHeSinhThai = dongVatProcessBO.listInfoDongVatHeSinhThai();
		ArrayList<DongVatChanNuoiModel> listDongVatChanNuoiModel = dongVatProcessBO.listInfoDongVatChanNuoiModel();
		ArrayList<DongVatLamSanNgoaiGoModel> listDongVatLamSanNgoaiGoModel = dongVatProcessBO.listInfoDongVatLamSanNgoaiGoModel();
		ArrayList<DongVatSanHoModel> listDongVatSanHoModel = dongVatProcessBO.listInfoDongVatSanHoModel();
		ArrayList<DongVatTenLaTinModel> listDongVatTenLaTinModel = dongVatProcessBO.listInfoDongVatTenLaTinModel();
		ArrayList<DongVatThamCoBienModel> listDongVatThamCoBienModel = dongVatProcessBO.listInfoDongVatThamCoBienModel();
		
		homeForm.setListDongVatHeSinhThai(listDongVatHeSinhThai);
		homeForm.setListDongVatChanNuoiModel(listDongVatChanNuoiModel);
		homeForm.setListDongVatLamSanNgoaiGoModel(listDongVatLamSanNgoaiGoModel);
		homeForm.setListDongVatSanHoModel(listDongVatSanHoModel);
		homeForm.setListDongVatTenLaTinModel(listDongVatTenLaTinModel);
		homeForm.setListDongVatThamCoBienModel(listDongVatThamCoBienModel);
		
		return mapping.findForward("begin");
	}

}
